Computer Science SLO Based Key Point Notes

👉👉👉 Computer Science 12th Class Notes (Main Page)

************************************

Unit 3: Object-Oriented Programming in C++

3.2.1 C++ Constants and Variables

Constant:

  • A constant is a quantity that cannot be changed during program execution.
  • It can be a number, a character, or a character string. A character string is a sequence of any number of characters.
  • Examples: 42, 7.25, ‘s’, “computer” etc.

Variable:

  • A quantity whose value may change during the execution of the program is called a variable.
  • A variable is a space in a computer’s memory, used to store data and given a name for easy reference. OR
  • In C language, a variable is a memory location that is identified by a name to store a data of particular type.

Rules for Naming a Variable:

Following are the rules for naming variables in C:
  1. A variable name may consist of digits, upper case, and lower case alphabets, and underscore symbols i.e. “_”
  2. The first character of a variable name must be an alphabet character or underscore.
  3. Keywords/Reserved words of C++ cannot be used as variable names.
  4. Special symbols such as $, @, %, #, etc. are not allowed.
  5. Two variables cannot be of the same name.
  6. C is a case-sensitive language. Variable names with the same spelling but different cases are treated as different variable names.
  7.  A meaningful name should be given to the variable which can help to understand the purpose of the variable.
  8. Blank space or comma is not allowed.


👇👇👇👇👇👇👇👇👇👇👇👇

************************************
👉👉👉 Computer Science 12th Class Notes (Main Page)

************************************


(National Book Foundation - As Federal Textbook Board, Islamabad 
Based on National Curriculum Pakistan 2026-2027 and Onward prescribed by Federal Board of Intermediate and Secondary Education, Islamabad, and All Pakistan Boards) 

{Contact WhatsApp +923339719149 for Class-XII Computer Science Complete SLO-Based Key Points notes in pdf format as well as in PowerPoint Presentation for preparing/delivering the Lectures}

Note:  Write me in the comments box below for any query and also Share this information with your class-fellows and friends.